{extend name="public:base" /}
{block name="main"}

{/block}
{block name="main"}
<div class="ShareAnyContainer" style="font-size: 14px;">
    当前位置：<a href="/" title="首页">首页</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a
        href="javascript:;" title="账号管理">账号管理</a>
</div>
<div class="ShareAnySeparate"></div>
<div class="ShareAnyContainer">
    <div class="line"></div>
</div>
<div class="ShareAnySeparate"></div>
<div class="ShareAnyContainer">
    <style>
        .form input{
            width:300px;
            padding:5px;
        }
        .form input:focus{
            border:1px solid #ff0000;
        }
    </style>
    <table style="width:100%;" border="0">
        <tr>
            <td valign="top" width="20%">{include file="public:account" /}</td>
            <td valign="top" width="5%">&nbsp;</td>
            <td valign="top" width="75%" style="line-height: 50px; text-align: center;" class="form">
                <p style="text-align: left; font-size: 25px;">账号管理</p>
                <p>手机：&nbsp;&nbsp;&nbsp;<input type="text" id="account"></p>

                <p>验证码：<input type="text" id="code"></p>
                <p>
                    <button id="getcode" style="padding:10px 25px;">获取验证码</button>
                    &nbsp;
                    <button id="submit" style="padding:10px 25px;">修改</button>
                </p>

            </td>
        </tr>
    </table>

</div>

<script>
        $(document).ready(function () {

            $("#getcode").on("click", function () {
                if(!$("#account").val()){
                    return alert('请输入正确的手机号');
                }
                $.ajax({
                    url: "{:url('/shop/account/code')}",
                    type: "POST",
                    data: {
                        number: $("#account").val()
                    },
                    success: function (data) {
                        alert('发送成功');
                    }
                });
            });
            $("#submit").on("click", function () {
                if(!$("#account").val()){
                    return alert('请输入正确的手机号');
                }
                $.ajax({
                    url: "{:url('/shop/account/ajaxUpdate')}",
                    type: "POST",
                    dataType: "JSON",
                    data: {
                        account: $("#account").val(),
                        code: $("#code").val()
                    },
                    success: function (data) {
                        alert(data.msg);
                        if (data.code == "1") {
                            window.location.href = "{:url('/shop/account/index')}";
                        }

                    }
                });
            });
        });
</script>
{/block}